<div class="profile_statstic">
	<h3>Статистика</h3>
	<?php echo $model->getAttributeLabel('personal_link'); ?> <?php echo $model->getPersonalLink();?>
	<?php echo CHtml::form()?>
	<p>Статистика выберите период или нажмите кнопку "показать" если хотите посмотреть полную статистику </p> 
	От<?php 
		$this->widget('zii.widgets.jui.CJuiDatePicker', array(
		    'id'=>'statistic_start_date',
			'name'=>'statistic_start_date',
		    'options'=>array(
		    	'showAnim'=>'fold',
				'dateFormat'=>'yy-mm-dd',
				'changeMonth'=>true,
				'changeYear'=>true,
			),
		    'htmlOptions'=>array(
				'readonly' => "readonly"
			),
			'language' => 'ru'
		 ));
	?>
	До
	<?php 
		$this->widget('zii.widgets.jui.CJuiDatePicker', array(
		    'id'=>'statistic_end_date',
			'name'=>'statistic_end_date',
		    'options'=>array(
		    	'showAnim'=>'fold',
				'dateFormat'=>'yy-mm-dd',
				'changeMonth'=>true,
				'changeYear'=>true,
			),
		    'htmlOptions'=>array(
				'readonly' => "readonly",
			),
			'language' => 'ru',
			'value'=>date('Y-m-d'),
		 ));
	?>
	
	<div class="row buttons">
		<?php echo CHtml::ajaxSubmitButton(
				'Показать', 
				$this->createUrl('/user/statistic'),
				array(
					'dataType'=> 'json',
					'success'=> 'function (transport) { showStatistic(transport) }', 
					'error'=>'function (transport) {if (transport.status != 200) alert(\'Sorry, but some error occured. Try again please\');}',
				),
				array('id'=>'statistic_button_id', 'class'=>'')
			); ?>
	</div>
	<?php echo CHtml::endForm()?>

	<div id="user_statistic">
	
	</div>
</div>

<script type='text/javascript'>
	/* <![CDATA[ */
		$(document).ready(function(){
			//$("#statistic_button_id").click();
		})	
		
		function showStatistic(transport) {
			if(transport && transport.result) {
				$('#user_statistic').html(transport.result);			
			}		
		}
	
	/* ]]> */
</script>